import React, { useEffect } from 'react';
import TableSearch from '@/pages/log/components/tableSearch';
import useFetchData from '@/hooks/getList';
import { Card, Table, TableColumnProps } from '@arco-design/web-react';
import { getUserDetail } from '@/api/userData';

function Example() {
  const { data, pagination, loading, getData } = useFetchData(
    getUserDetail,
    {}
  );
  const columns: TableColumnProps[] = [
    {
      title: '日期',
      dataIndex: 'Date',
      align: 'center',
    },
    {
      title: '当日下载量',
      dataIndex: 'TodayDownloadCount',
      align: 'center',
    },
    {
      title: '当日注册量',
      dataIndex: 'TotalActivateCount',
      align: 'center',
    },
  ];
  useEffect(() => {
    getData();
  }, []);

  return (
    <div>
      <TableSearch getSearchData={(data) => getData(data)} />
      <Card>
        <Table
          columns={columns}
          pagination={pagination}
          data={data}
          loading={loading}
          rowKey="Date"
        />
      </Card>
    </div>
  );
}

export default Example;
